/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vng.survey.controller;

import com.vng.zing.survey.thrift.client.SurveyClient;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.vng.zing.survey.thrift.model.Error;
import vng.survey.model.CommonModel;


/**
 *
 * @author namhh
 */
public class AjaxDeleteSurvey extends BaseController {

    @Override
    public String render(HttpServletRequest request, HttpServletResponse resp) throws IOException, Exception {
        int idSurvey = Integer.parseInt(request.getParameter("idSurvey"));
        SurveyClient surveyClient = SurveyClient.getInstance();
        Error error  = surveyClient.removeSurveyItem(idSurvey, 1);
        if (error == Error.SUCCESS) {
            return CommonModel.toJSON("Thông báo", "Xóa thành công!");
        } else {
        
            return CommonModel.toJSON("Thông báo", "Vui long thư lại sau!");
        }
    }

}
